<?php foreach ($arrLang as $lang):?>
	<img class="img-lang" src="<?php echo $this->url->content($lang->flag);?>" alt="<?php echo $lang->code;?>" title="<?php echo $lang->name;?>" />
<?php endforeach;?>
<script>
	$(document).ready(function(){
		$(".img-lang").click(function(){
			$.ajax({
				url: "<?php echo $this->url->action('chooseLang', 'Components', '');?>",
				data: {langCode: $(this).attr('alt'),
						url: window.location.href},
				type: "POST",
				dataType: "json",
				success: function(response){
					if (response.success)
						location.href = response.url;
				}
			});
		});
	});
</script>